Algo Algo   C++   C#   Demo   JS   Py   SQL   Stat   TA

Number of Sequences

P-sequences

A[1..N], (A[i] * A[i + 1]) <= P, N <= 10^3, P <= 10^9, A[i] >= 1 Number of P-sequences of A[1..N]: 1) DP0[N, R], where R = N-th term of P-sequence. 2) DP1[N, R], where R = maximum possible number that can be N+1-th term of P-sequence.

Algo Algo   C++   C#   Demo   JS   Py   SQL   Stat   TA